Most computer programs are written as source code in a high-level programming language such as the C language. Typically, the program may be written in many different ways to obtain the same overall result. The different ways of writing such a program reflect different balances between various constraints that include the speed at which the program is to operate, the programmer's or programming manager's sense of style, the importance of maintaining or updating the program over time, and the portability of the program from the processor and compiler environment in which it is written to other processor or compiler formats.
To maximize the long-term usefulness of source code, software development managers often establish guidelines for the style, maintainability, and portability of the source code to be written. Style guidelines are important in large programs, for example, to ensure consistent format in the program modules or sections written by different programmers.
Portability guidelines address the compatibility of a particular program with different types of computer, compiler, or operating system. For example, the C language has several main "standards" and is implemented in different computers and operating systems with many nonstandard features. Portability guidelines can help prevent a programmer from incorporating into the source code nonstandard or unique features of the particular C language "standard" in which a program is written. As a result, the source code would be compatible with different computers, compilers, and operating systems despite being written in one particular environment.
Maintainability guidelines address the ability to update, correct, or modify the source code sometime after it is originally written. Some programmers tend to write source code that is very abstract, complex, and compact. Such source code can be extremely difficult to maintain. Maintainability guidelines typically require that source code be written with a particular degree of simplicity and clarity to facilitate later modification. As a result, maintainability guidelines can reduce the need to discard a program and write a completely new one.
Compliance with programming guidelines is typically monitored by manual inspection of source code. For example, the source code may be read by the manager of a software development group or by other programmers within the group. Automatic (i.e., computer-executed) source code analysis is typically limited to the detection of source code errors that prevent compilation. Such automatic source code analysis is further limited in that the errors to be detected are typically fixed by the requirements of the compiler, thereby being unadaptable to guidelines concerning style, maintainability, and portability.